{% extends "base.html" %}

{% block content %}
<script type="text/javascript">
    $(function() {
        $( "input#id_plannedStart" ).datepicker({dateFormat: 'dd.mm.yy'});
        $( "input#id_plannedEnd" ).datepicker({dateFormat: 'dd.mm.yy'});
        $( "input#id_actualStart" ).datepicker({dateFormat: 'dd.mm.yy'});
        $( "input#id_actualEnd" ).datepicker({dateFormat: 'dd.mm.yy'});
    });
</script>
<form method="POST" action="{% if workorder.pk %}{% url posecco:workorder workorder.rfc.pk workorder.pk %}{% else %}{% url posecco:workorder rfc_id 0 %}{% endif %}">
    {% csrf_token %} 
    {{ workorder_form.as_p }}
	{% if request.user == workorder.responsible and workorder.status == 2 %}
	<input name="resolve" type="submit" value="Resolve" class="button" />
	<input name="reject" type="submit" value="Reject" class="button" />
	<input name="save" type="submit" value="Save" class="button" />
	{% else %}
	<input name="save" type="submit" value="Save" class="button" />
	<input name="close" type="submit" value="Cancel" class="button" />
	{% endif %}
</form>
{% endblock %}